<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>自定义导航</title>
    <link rel="shortcut icon" href="../static/img/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="../static/layui/css/layui.css"/>
    <link rel="stylesheet" href="../static/css/index.css"/>
</head>
<body>
    <div id="bigBox">
        <div id="logoBox">
            <img id="logoImg" onclick="switchLogo();" defaultEngine="{{data_dict.default_engine}}" src="../static/img/{{data_dict.default_engine}}.png">
        </div>
        <div id="searchDiv">
            <div class="layui-input-block" style="margin-left: 0px;">
                <input type="text" id="searchInput" name="title" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                <i onclick="goSearch();" class="layui-icon layui-icon-search index-search"></i>
            </div>
        </div>
        <div id="addTypeDiv" class="ele-hidden">
            <span onclick="addType();">添加分类</span>
            <span onclick="addSite();">添加站点</span>
        </div>
        <form id="siteForm" action="" style="width:600px;">
            <div class="layui-tab layui-tab-brief" lay-filter="siteTab">
                <ul id="ul-tab" class="layui-tab-title">
                    {% for item in data_dict.category %}
                        <li lay-id="{{forloop.counter0}}"{% if forloop.first %} class="layui-this"{% endif %}>
                            {{ item.type }}
                        </li>
                        <span class="ele-hidden" sid="{{forloop.counter0}}">
                            <i class="layui-icon layui-icon-edit custom-edit" onclick="editType(this);"></i>  
                            <i class="layui-icon layui-icon-close custom-close" onclick="deleteType(this);"></i>  
                        </span>
                    {% endfor %}
                </ul>
                <div class="layui-tab-content">
                    {% for item in data_dict.category %}
                        <div class="layui-tab-item{% if forloop.first %} layui-show{% endif %}" sid="{{forloop.counter0}}"> 
                            {% for s in item.sites %}
                            <span class="span-site">
                                <a href="{{s.site}}" target="_blank" title="{{s.name}}" class="layui-btn layui-btn-primary a-site" lay-event="show">
                                    {{s.name}}
                                </a>
                                <span class="ele-hidden">
                                    <i class="layui-icon layui-icon-edit custom-edit" onclick="editSite(this);"></i>  
                                    <i class="layui-icon layui-icon-close custom-close" onclick="deleteSite(this);"></i>  
                                </span>
                            </span>
                            {% endfor %}
                        </div>
                    {% endfor %}
                </div>
            </div>
        </form>
    </div>

    <form class="layui-form ele-hidden" id="editTypeForm" action="">
        <div class="layui-form-item">
            <input type="text" name="type" placeholder="分类" required lay-verify="required" class="layui-input input-220">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="editTypeFormSubmit">完成</button>
            <button onclick="layerCancel();" type="button" class="layui-btn layui-btn-primary">取消</button>
        </div>
    </form>

    <form class="layui-form ele-hidden" id="editSiteForm" action="">
        <div class="layui-form-item">
            <input type="text" name="name" placeholder="名称" required lay-verify="required" class="layui-input input-220">
        </div>
        <div class="layui-form-item">
            <input type="text" name="site" placeholder="网址" required lay-verify="required" class="layui-input input-220">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="editSiteFormSubmit">完成</button>
            <button onclick="layerCancel();" type="button" class="layui-btn layui-btn-primary">取消</button>
        </div>
    </form>

    <div id="footer">
		<span id="custom">自定义</span>
		<span id="saveGlobal" class="ele-hidden">保存</span>
	</div>

    <script src="../static/layui/layui.js"></script>
    <script src="../static/js/index.js"></script>
    <script src="../static/sortable/Sortable.min.js"></script>

</body>
</html>